package com.example.demo1101.demo1;

public class TestSleep {
    public static void main(String[] args) {
        SleepDemo sleepDemo = new SleepDemo();
        sleepDemo.start();
    }
}

class SleepDemo extends Thread {
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName() + "" + i);

        }
    }


}

